#!/bin/sh
echo $(which npm)
basepath="$( cd "$( dirname "$0" )" && pwd )"
echo $basepath
start(){
  echo "";
}

stop(){
    pid=$(ps aux | grep node-pawer | grep -v "grep" | head -1 | awk '{print $2}')
    while [ -n "$pid" ]
    do
      kill $pid
      pid=$(ps aux | grep node-pawer | grep -v "grep" | head -1 | awk '{print $2}')
    done
}

status(){
    ps aux | grep node-pawer | grep -v "grep"
}


action=$1
#[ -z \$1 ] && action=status
case "$action" in
'start')
    start
    ;;
'stop')
    stop
    ;;
'status')
    status
    ;;
'restart')
    stop
    start
    ;;
*)
    echo "Usage: $0 { start | stop | restart | status }"
    ;;
esac
exit
